﻿using SD.Infrastructure.RepositoryBase;
using SlamDunk.MES.Domain.Entities.QualityContext;
using SlamDunk.MES.ReportView.Models;
using SlamDunk.ValueObjects.Enums;
using System;
using System.Collections.Generic;

namespace SlamDunk.MES.Domain.IRepositories.Interfaces.QualityContext
{
    /// <summary>
    /// 质量检查仓储接口
    /// </summary>
    public interface IQualityInspectionRepository : IAggRootRepository<QualityInspection>
    {
        #region # 分页获取作业计划质量检查列表 —— ICollection<ExecutionPlanInspection> FindExecutionPlanInspectionsByPage(...
        /// <summary>
        /// 分页获取作业计划质量检查列表
        /// </summary>
        /// <param name="keywords">关键字</param>
        /// <param name="executionPlanId">作业计划Id</param>
        /// <param name="checkStatus">审核状态</param>
        /// <param name="startTime">开始时间</param>
        /// <param name="endTime">结束时间</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页容量</param>
        /// <param name="rowCount">总记录数</param>
        /// <param name="pageCount">总页数</param>
        /// <returns>作业计划质量检查列表</returns>
        ICollection<ExecutionPlanInspection> FindExecutionPlanInspectionsByPage(string keywords, Guid? executionPlanId, CheckStatus? checkStatus, DateTime? startTime, DateTime? endTime, int pageIndex, int pageSize, out int rowCount, out int pageCount);
        #endregion

        #region # 分页获取工单质量检查列表 —— ICollection<WorkOrderInspection> FindWorkOrderInspectionsByPage(...
        /// <summary>
        /// 分页获取工单质量检查列表
        /// </summary>
        /// <param name="keywords">关键字</param>
        /// <param name="executionPlanId">作业计划Id</param>
        /// <param name="workOrderId">工单Id</param>
        /// <param name="checkStatus">审核状态</param>
        /// <param name="startTime">开始时间</param>
        /// <param name="endTime">结束时间</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页容量</param>
        /// <param name="rowCount">总记录数</param>
        /// <param name="pageCount">总页数</param>
        /// <returns>工单质量检查列表</returns>
        ICollection<WorkOrderInspection> FindWorkOrderInspectionsByPage(string keywords, Guid? executionPlanId, Guid? workOrderId, CheckStatus? checkStatus, DateTime? startTime, DateTime? endTime, int pageIndex, int pageSize, out int rowCount, out int pageCount);
        #endregion

        #region # 获取产品合格率字典 —— IDictionary<Guid, decimal> GetProductQualifiedRates(DateTime inspectedDate)
        /// <summary>
        /// 获取产品合格率字典
        /// </summary>
        /// <param name="inspectedDate">质检日期</param>
        /// <returns>产品合格率字典</returns>
        IDictionary<Guid, decimal> GetProductQualifiedRates(DateTime inspectedDate);
        #endregion

        #region # 获取产品产出周期概要字典 —— {DateTime, ProductQuantityInfo[]} GetProductOutputPeriodicSummaries(...
        /// <summary>
        /// 获取产品产出周期概要字典
        /// </summary>
        /// <param name="startTime">开始时间</param>
        /// <param name="endTime">结束时间</param>
        /// <returns>产品产出周期概要字典</returns>
        /// <remarks>
        /// 键：日期，值：产品数量列表
        /// </remarks>
        IDictionary<DateTime, ProductQuantityInfo[]> GetProductOutputPeriodicSummaries(DateTime startTime, DateTime endTime);
        #endregion

        #region # 获取产品数量列表 —— ICollection<ProductQuantityInfo> GetProductQuantities(DateTime startTime...
        /// <summary>
        /// 获取产品数量列表
        /// </summary>
        /// <param name="startTime">开始时间</param>
        /// <param name="endTime">结束时间</param>
        /// <returns>产品数量列表</returns>
        ICollection<ProductQuantityInfo> GetProductQuantities(DateTime startTime, DateTime endTime);
        #endregion
    }
}
